package com.neusoft.neu24.his.hisapp.dao.impl;

import com.neusoft.neu24.his.hisapp.dao.IPatientDao;
import com.neusoft.neu24.his.hisapp.entity.Patient;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public class PatientDaoImpl implements IPatientDao {

    private  static final List<Patient> PATIENT_LIST =new ArrayList<>();
    static {
        PATIENT_LIST.add(new Patient("11","张三","男","未接诊"));
        PATIENT_LIST.add(new Patient("1111","李四","女","未接诊"));
        PATIENT_LIST.add(new Patient("1113","王五","男","未接诊"));
        PATIENT_LIST.add(new Patient("1114","赵六","女","接诊中"));
        PATIENT_LIST.add(new Patient("125211","孙七","男","接诊中"));
        PATIENT_LIST.add(new Patient("11611","周八","女","接诊中"));
        PATIENT_LIST.add(new Patient("1227","吴九","男","已完成"));
        PATIENT_LIST.add(new Patient("82","郑十","女","已完成"));
        PATIENT_LIST.add(new Patient("91","郑十一","男","已完成"));
        PATIENT_LIST.add(new Patient("110","郑十二","女","已完成"));
        PATIENT_LIST.add(new Patient("1111","郑十三","男","已完成"));
    }


    @Override
    public List<Patient> selectAllPatient() {
        return PATIENT_LIST;
    }

    @Override
    public List<Patient> selectPatientByAge(String age) {
        return PATIENT_LIST.stream()
                        .filter(patient -> patient.getAge().indexOf(age)> -1)
                .collect( Collectors.toList() );
    }
}
